﻿using System;
using System.Collections.Generic;
using System.Text;
using EM.OA.DataModel.DBModel;
using EM.OA.DAL;
using System.Linq;

namespace EM.OA.BLL 
{
	public class WFApprovalBLL : BLLBase<EMOA_WF_Approval>
	{
        public List<EMOA_WF_Approval> GetApprovallist(Guid applyID)
        {
            using (var db = new EMOAContext())
            {
                var list = from a in db.EMOA_WF_Approval
                           where a.ApplyID == applyID
                           orderby a.CreateTime
                           select new
                           {
                               a,
                               StepLevel = (from b in db.EMOA_WF_FlowConfigDetail where b.FlowConfigDetailID == a.FlowConfigDetailID select b.StepLevel).FirstOrDefault(),
                               ApprovalUserName = (from b in db.EMOA_User where b.UserID == a.ApprovalUserID select b.EmployeeName).FirstOrDefault()
                           };

                return EM.FrameWork.Common.GenerateComplexObject<EMOA_WF_Approval>(list.ToList());
            }
        }
	}
}